﻿<%@ page import="com.wanmait.recruitment.pojo.Job" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<!DOCTYPE HTML>
<%@page contentType="text/html; charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<% String path = request.getContextPath(); %>
<html xmlns:wb="http://open.weibo.com/wb">
<head>

    <script id="allmobilize" charset="utf-8" src="<%=path%>/static/web/js/allmobilize.min.js"></script>

    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="alternate" media="handheld"/>
    <link href="<%=path%>/static/web/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="<%=path%>/static/web/css/font-awesome.min.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/web/css/wangEditor.css">
    <link type="text/css" rel="stylesheet" href="<%=path%>/static/web/css/shCoreEclipse.css" />
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/web/css/pifu.css">
    <!-- end 云适配 -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>职位详情</title>
    <style>
        .project-header p{line-height:30px}.project-header h1{line-height:50px}.project-content{padding-right:3.1%;padding-left:3.1%;background-color:#fff;padding-top:10px;}.pl .plul{word-wrap:break-word;width:100%;padding-top:10px;padding-bottom:10px;font-size:14px;background-color:#fafafa;}.z13{font-size:13px}.plbg{background-color:#fafafa;border-bottom:1px dotted #DCDCDC;}.pl{padding:0px;}a{color:#000;text-decoration:none;}a:hover{color:#337ab7;text-decoration:none;}.project-header .yw{color:#009ade}.in100,.in2,.huif{border-top:0px}.huif{padding-top:0px}.y{animation-delay:2s;animation:move 3s infinite;}@keyframes move{0%{border:1px solid #e8e8e8;}50%{border:1px solid #f96c65;}100%{border:1px solid #e8e8e8;}}.zuo h4{line-height:36px;font-size:16px;font-weight:bold}.zuo a{display:block;line-height:26px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.project-header2{width:921px;border-bottom:1px solid #e8e8e8;border-radius:3px 3px 0 0;border-top:1px solid #fff;height:auto;margin:auto;padding:20px 25px 0;z-index:9;background-color:#fff}.affix-top{top:121px}.adcssb{border:1px solid #93d0a8}.foot a{color:#337ab7}textarea{outline:none;border:0px;transition:1s;border:1px solid #DDDDDD;-moz-box-shadow:2px 2px 4px #f5f5f5 inset;-webkit-box-shadow:2px 2px 4px #f5f5f5 inset;box-shadow:2px 2px 4px #f5f5f5 inset;padding:10px}textarea:focus{outline:none !important;background-color:#fafbf5;border:1px solid #4ca957;-moz-box-shadow:2px 2px 4px #e8e9e4 inset;-webkit-box-shadow:2px 2px 4px #e8e9e4 inset;box-shadow:2px 2px 4px #e8e9e4 inset;}textarea::-webkit-input-placeholder{color:#A4A4A4;}textarea::-moz-placeholder{color:#A4A4A4;}textarea:-moz-placeholder{color:#A4A4A4;}textarea:-ms-input-placeholder{color:#A4A4A4;}.btn-primary{color:#fff;background-color:#3ab143;border-color:#399c3f;}
    </style>
    <script type="text/javascript">
        var ctx = "h";
    </script>
    <link rel="Shortcut Icon" href="h/images/favicon.ico">
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/web/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/web/css/external.min.css"/>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/web/css/popup.css"/>
    <script src="<%=path%>/static/web/js/jquery.1.10.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="<%=path%>/static/web/js/jquery.lib.min.js"></script>
    <script src="<%=path%>/static/web/js/ajaxfileupload.js" type="text/javascript"></script>
    <script src="<%=path%>/static/web/js/jquery-hbzx.js" type="text/javascript"></script>


    <script src="<%=path%>/static/js/bootstrap.min.js"></script>
    <link href="<%=path%>/static/web/css/my.css" rel="stylesheet" media="screen">
    <link href="<%=path%>/static/web/css/dl.css" rel="stylesheet" media="screen">
    <!--[if lte IE 8]>
    <script type="text/javascript" src="<%=path%>/static/web/js/excanvas.js"></script>
    <![endif]-->
    <script type="text/javascript">
        var youdao_conv_id = 271546;
    </script>
    <script>
        $(function () {
            var pageNum = 1;
            initdata(${job.id},pageNum);
            $(".project-content").on("click",".Pagination a",function () {
                var pagernum = $(this).data("pagenum");
                initdata(${job.id},pagernum);
                return false;
            });
        });
        function initdata(jobId,pageNum) {
            $.ajax({
                url:"<%=path%>/zhuang/job/comment1",
                type:"get",
                data:{jobId:jobId,pageNumber:pageNum},
                success:function (resource) {
                    $(".project-content").html(resource);
                }
            });
        }
    </script>
    <script type="text/javascript" src="<%=path%>/static/web/js/conv.js"></script>
    <!--投递简历-->
    <script>
        $(function () {
            $("#submit").click(submitForm);
            $("#confirmCancel").click(confirmCancel);
            $("#leaveCancel").click(leaveCancel);
            $("#uncollected").click(collection);
            $("#collected").click(cancelColl);
        });

        function submitForm() {
            var resumeId = $("input[type=radio]:checked").val();
            if (resumeId == null) {
                alert("请选择要投递的简历！");
            } else {
                $("#resumeSendForm").submit();
                $("#cboxClose").click();
            }
        }

        //确认取消投递
        function confirmCancel() {
            $.ajax({
                url: "/zhuang/job/confirmCancel",
                data: {
                    <c:if test="${!(deliver eq null)}">deliverId:${deliver.id}, </c:if>
                    jobId:${job.id}, companyId:${job.company.id}
                },
                async: false,
                success: function () {
                    $("#cboxClose").click();
                    location.reload();
                }
            });
        }

        //不取消投递
        function leaveCancel() {
            $("#cboxClose").click();
        }

        //收藏
        function collection() {
            $.ajax({
                url: "/zhuang/job/collection",
                data: {jobId:${job.id}, sign: "collection"},
                async: false,
                success: function () {
                    $("#uncollected").css("display", "none");
                    $("#collected").css("display", "block");
                }
            });
        }

        //取消收藏
        function cancelColl() {
            $.ajax({
                url: "/zhuang/job/collection",
                data: {jobId:${job.id}, sign: "cancelColl"},
                async: false,
                success: function () {
                    $("#collected").css("display", "none");
                    $("#uncollected").css("display", "block");
                }
            });
        }
    </script>
</head>
<body>
<div id="body">

    <jsp:include page="/zhuang/include/header"></jsp:include>
    <div id="container">
        <div class="clearfix">
            <div class="content_l">
                <dl class="job_detail">
                    <dt>
                        <h1 title="${job.name}">
                            <em></em>
                            ${job.name}
                        </h1>
                        <c:if test="${sessionScope.userinfo eq null && company eq null}">
                            <a class="jd_collection" href="/zhuang/login" title="登录"></a>
                        </c:if>
                        <c:if test="${!(sessionScope.userinfo eq null)}">
                            <c:if test="${collection eq null}">
                                <a id="uncollected" title="收藏"></a>
                                <a style="display:none;" id="collected" title="收藏"></a>
                            </c:if>
                            <c:if test="${!(collection eq null)}">
                                <a id="collected" title="收藏"></a>
                                <a style="display:none;" id="uncollected" title="收藏"></a>
                            </c:if>
                        </c:if>
                    </dt>
                    <dd class="job_request">
                        <span class="red">${job.money.range}</span>
                        <span>${job.city.cityName}</span>
                        <span>经验${job.exRequire.require} </span>
                        <span> ${job.degree.title}</span>
                        <span>${job.natures.title}</span><br/>
                        福利待遇 : ${job.treatment}
                        <div>发布时间：<fmt:formatDate value="${job.inputTime}" pattern="yyyy-MM-dd HH:mm:ss"/></div>
                    </dd>
                    <dd class="job_bt">
                        <h3 class="description">职位描述</h3>
                        ${job.describe}
                    </dd>
                    <c:if test="${sessionScope.userinfo eq null && company eq null}">
                        <dd class="unresume">
                            <div>投递简历请先<a href="/zhuang/login" title="登录">登录</a></div>
                        </dd>
                    </c:if>
                    <c:if test="${!(sessionScope.userinfo eq null)}">
                        <c:if test="${resumes eq null}">
                            <dd class="unresume">
                                <div>你可以<a href="/zhuang/user/jianli" target="_blank" title="完善在线简历">完善在线简历</a>直接投递
                                </div>
                            </dd>
                        </c:if>
                        <c:if test="${!(resumes eq null)}">
                            <c:if test="${deliver eq null}">
                                <c:forEach items="${resumes}" var="resume" varStatus="stat">
                                    <c:if test="${stat.first}">
                                        <dd class="resume resume_web">
                                            <div>
                                        <span>
                                            你已有可投递的在线简历：<a title="${sessionScope.userinfo.name}的简历" target="_blank"
                                                           href="/zhuang/user/jianli?id=${resume.id}"><strong>${sessionScope.userinfo.name}的简历</strong></a>
                                        </span><br>
                                                <span>
                                            <c:if test="${!(resume.updateTime eq null)}">
                                                简历更新于<fmt:formatDate value="${resume.updateTime}"
                                                                     pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
                                            </c:if>
                                            <c:if test="${resume.updateTime eq null}">
                                                简历更新于<fmt:formatDate value="${resume.inputTime}"
                                                                     pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
                                            </c:if>
                                        </span>
                                            </div>
                                            <span class="setBtns">
                                            <a target="_blank" title="预览"
                                               href="/zhuang/user/preview?id=${resume.id}">预览</a> |
                                            <a title="修改" target="_blank"
                                               href="/zhuang/user/jianli?id=${resume.id}">修改</a>
                                        </span>
                                        </dd>
                                    </c:if>
                                </c:forEach>
                                <dd>
                                    <c:if test="${!(sessionScope.userinfo eq null)}">
                                        <a title="投个简历" class="btn fr btn_apply inline cboxElement"
                                           href="#setResumeApply">投个简历</a>
                                    </c:if>
                                </dd>
                            </c:if>
                            <c:if test="${!(deliver eq null)}">
                                <dd class="resume resume_web">
                                    <div>
                                        <span>你已投递该职位</span><br>
                                        <span>
                                        投递时间<fmt:formatDate value="${deliver.inputTime}"
                                                            pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
                                    </span>
                                    </div>
                                </dd>
                                <dd>
                                    <a title="取消投递" class="btn fr btn_apply inline cboxElement" href="#cancelDeliver">取消投递</a>
                                </dd>
                            </c:if>
                        </c:if>
                    </c:if>

                </dl>
            </div>
            <div class="content_r">
                <dl class="job_company">
                    <dt>
                        <a href="/zhuang/company/myhome?id=${job.company.id}" target="_blank">
                            <img class="b2" src="<%=path%>/static/uploadImg/${job.company.logo}"
                                 width="80" height="80" alt="${job.company.companyName}"/>
                            <div>
                                <h2 class="fl">
                                    ${job.company.companyName}
                                    <img src="<%=path%>/static/web/images/valid.png" width="15" height="19"
                                         alt="壮壮认证企业"/>
                                    <span class="dn">壮壮认证企业</span>
                                </h2>
                            </div>
                        </a>
                    </dt>
                    <dd>
                        <ul class="c_feature reset">
                            <li><span>领域</span> ${job.company.industry.industryName}</li>
                            <li><span>规模</span> ${job.company.scale.range}</li>
                            <li>
                                <span>主页</span>
                                <a href="${job.company.website}" target="_blank" title="${job.company.website}"
                                   rel="nofollow">${job.company.website}</a>
                            </li>
                        </ul>

                        <h4>发展阶段</h4>
                        <ul class="c_feature reset">
                            <li><span>目前阶段</span> ${job.company.stage.stageName}</li>
                        </ul>

                    <h4>公司地址</h4>
                    <div>${job.company.address}</div>
                    <div id="smallmap"></div>
                    <a href="javascript:;" id="mapPreview">查看完整地图</a>
                </dd>
            </dl>
        </div>
    </div>
    <%--<div class="yn jz container-fluid nav-bgn m0 visible-lg visible-md visible-sm">
    </div>--%>
    <div class="yn jz container-fluid nav-bgn m0 visible-lg visible-md visible-sm" id="menu_wrap"></div>
    <div class="container m0 bod top70" id="zt">
        <div class="col-lg-9 col-md-12 col-sm-12">
            <div class="project-content">

            </div>
        </div>
    </div>
    <div id="tipOverlay"></div>
    <!-------------------------------------弹窗lightbox  ----------------------------------------->
    <div style="display:none;" id="toudi">
        <!-- 投递简历时 -->
        <div style="height:280px;" class="popup" id="setResumeApply">
            <table width="100%">
                <tbody>
                <tr>
                    <td class="f18 c5">请选择你要投出去的简历：</td>
                </tr>
                <tr>
                    <td>
                        <form class="resumeSetForm" action="/zhuang/job/jobDetail" method="post">
                            <c:forEach items="${resumes}" var="resume" varStatus="stat">
                                <label class="radio">
                                    <input type="radio" value="${resume.id}" class="resume${resume.id}"
                                           name="resumeId">
                                    在线简历：
                                    <span title="${resume.name}的简历">${resume.name}的简历</span>
                                </label>
                                <div class="setBtns">
                                    <a target="_blank" href="/zhuang/user/preview?id=${resume.id}">预览</a> |
                                    <a target="_blank" href="/zhuang/user/jianli?id=${resume.id}">修改</a>
                                </div>
                            </c:forEach>
                            <input type="hidden" id="comJobId" name="jobId" value="${job.id}">
                            <input type="hidden" name="companyId" value="${job.company.id}">
                            <input type="submit" value="确认投递" class="btn_profile_save btn_s" id="submit">
                        </form>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <!--/#setResumeApply-->
        <!-- 取消投递时-->
        <div style="height:280px;" class="popup" id="cancelDeliver">
            <table width="100%">
                <tr>
                    <td style="text-align: center;">
                        <h1 style="font-size: 27px;">确认要取消该职位的投递吗?</h1>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center;">
                        <button value="确认" class="btn_s" id="confirmCancel">确认</button>
                        <button value="取消" class="btn_s" id="leaveCancel">取消</button>
                    </td>
                </tr>
            </table>
        </div>

            <style>
                #cboxContent {
                    overflow: visible;
                }

                #colorbox, #cboxOverlay, #cboxWrapper {
                    overflow: visible;
                }
            </style>

            <!--地图弹窗-->
            <div id="baiduMap" class="popup">
                <div id="allmap"></div>
            </div><!--/#baiduMap-->
        </div>
        <!------------------------------------- end ----------------------------------------->

        <script type="text/javascript" src="<%=path%>/static/web/js/job_detail.js"></script>
        <script type="text/javascript" src="<%=path%>/static/web/js/count.js"></script>

        <script type="text/javascript"
                src="http://api.map.baidu.com/api?v=2.0&ak=3d6a9f4b807441569414b01eecc20959"></script>
        <script type="text/javascript">
            //百度地图API功能
            var sMap = new BMap.Map("smallmap");
            sMap.enableScrollWheelZoom(true);

            if ($('#positionLat').val() && $('#positionLng').val()) {
                var sPoint = new BMap.Point($('#positionLng').val(), $('#positionLat').val());
                sMap.centerAndZoom(sPoint, 12);
                sMap.addOverlay(new BMap.Marker(sPoint));              // 将标注添加到地图中

            } else {
                // 创建地址解析器实例
                var sMyGeo = new BMap.Geocoder();
                // 将地址解析结果显示在地图上,并调整地图视野
                sMyGeo.getPoint("${job.company.address}", function (sPoint) {
                    if (sPoint) {
                        sMap.centerAndZoom(sPoint, 16);
                        sMap.addOverlay(new BMap.Marker(sPoint));
                    }
                }, "${job.company.city.cityName}");
            }

            /*弹窗大地图*/
            var map = new BMap.Map("allmap");
            map.addControl(new BMap.NavigationControl());
            map.addControl(new BMap.MapTypeControl());
            map.addControl(new BMap.OverviewMapControl());
            map.enableScrollWheelZoom(true);
            // 创建地址解析器实例
            var gc = new BMap.Geocoder();
            $(function () {
                $('#mapPreview').bind('click', function () {
                    $.colorbox({inline: true, href: "#baiduMap", title: "公司地址"});
                    var address = "${job.company.address}";
                    var city = "${job.city.cityName}";
                    var lat = $('#positionLat').val();
                    var lng = $('#positionLng').val();
                    map.setCurrentCity(city);
                    map.setZoom(12);
                    if (lat && lng) {
                        var p = new BMap.Point(lng, lat);
                        var marker = new BMap.Marker(p);  // 创建标注
                        map.addOverlay(marker);              // 将标注添加到地图中
                        setTimeout(function () {
                            map.centerAndZoom(p, 15);
                        }, 1000);
                        map.setCenter(p);
                        map.setZoom(15);
                        var sContent =
                            "<h4 style='margin:0 0 5px 0;padding:0.2em 0'>" + city + "</h4>" +
                            "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>" + address + "</p>" +
                            "</div>";
                        var infoWindow = new BMap.InfoWindow(sContent);  // 创建信息窗口对象
                        //图片加载完毕重绘infowindow
                        marker.openInfoWindow(infoWindow);
                    } else {
                        gc.getPoint(address, function (point) {
                            if (point) {
                                var p = new BMap.Point(point.lng, point.lat);
                                var marker = new BMap.Marker(p);  // 创建标注
                                map.addOverlay(marker);              // 将标注添加到地图中
                                setTimeout(function () {
                                    map.centerAndZoom(p, 15);
                                }, 1000);
                                map.setZoom(14);
                                var sContent =
                                    "<h4 style='margin:0 0 5px 0;padding:0.2em 0'>" + city + "</h4>" +
                                    "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>" + address + "</p>" +
                                    "</div>";
                                var infoWindow = new BMap.InfoWindow(sContent);  // 创建信息窗口对象
                                //图片加载完毕重绘infowindow
                                marker.openInfoWindow(infoWindow);
                            }
                        }, city);
                    }


                });

        });
    </script>
    <jsp:include page="/zhuang/include/backTop"></jsp:include>
</div><!-- end #container -->
</div><!-- end #body -->
<jsp:include page="/zhuang/include/footer"></jsp:include>

<script type="text/javascript" src="<%=path%>/static/web/js/core.min.js"></script>
<script type="text/javascript" src="<%=path%>/static/web/js/popup.min.js"></script>

<!--投递简历-->
<script>
    $(function () {
        $("#submit").click(function () {
            submitForm();
        });
    });

    function submitForm() {
        var resumeId = $("input[type=radio]:checked").val();
        if (resumeId == null) {
            alert("请选择要投递的简历！");
        } else {
            $("#resumeSendForm").submit();
            $("#cboxClose").click();
        }
    }
</script>
</body>
</html>